# -*- coding: utf-8 -*-
"""
 @Time    : 2021/1/22 下午4:20
 @Author  : tgy
 
"""


class MyEnumerate:
    __slots__ = ['_iterable', '_count', '_iter']

    def __init__(self, iterable):
        self._iterable = iterable

    def __iter__(self):
        tmp = MyEnumerate(self._iterable)
        tmp._iter = self._iterable.__iter__()
        tmp._count = 0
        return tmp

    def __next__(self):
        res = (self._count, next(self._iter))
        self._count += 1
        return res

    def run(self):
        ...

def test01():
    l = [2, 3, 4]
    for i, val in MyEnumerate(l):
        print(i, val)

if __name__ == '__main__':
    ...
    l = [2, 3, 4]
    # map min max reduce,filter 都是可迭代对象
    print(map(lambda x: x ** 2, l).__iter__().__next__())
    print(list(map(lambda x: x ** 2, l)))
    print(any([1, 2, 3]))
    persons = {'name':'zhangsan', 'age': 21}
    print(persons.keys().__iter__().__next__())
    print(dir(MyEnumerate))